////////////////////////////////////////////////////////////////////////////////
//File:					UglyOpenGlError.h
//Author:				Kesitem
//This file is part of UglyProject.
//See UglyProject.txt for copyright informations.
////////////////////////////////////////////////////////////////////////////////
#ifndef __ULGYOPENGLERROR_H__
#define __ULGYOPENGLERROR_H__

#include "UglyCore.h"

namespace Ugly
{

/**
 * \brief Utility to check OpenGL error.
 */
class OpenGlError
{
public:

    /**
     * \brief Get an unique instance of the class.
     *
     * \return Class instance.
     */
	static OpenGlError &instance();

    /**
     * \brief Perform a quick check on a OpenGL call. Write text and error in log.
     *
     * \param   _Text   Text to write in log if error.
     */
    void quickCheck(const std::string &_Text);

    /**
     * \brief Check if there is an error.
     *
     * \return True if error.
     */
    bool check();

    /**
     * \brief Get the error description.
     *
     * \return Error description.
     */
    std::string getErrorDesc();

private:

    /**
     * \brief Constructor.
     */
    OpenGlError();

    /**
     * \brief Destructor.
     */
    virtual ~OpenGlError();

private:

    /**
     * Error description.
     */
    std::string mErrorDescription;
};

/**
 * \brief Global instance of the OpenGlError.
 */
extern OpenGlError &gOpenGlError;

}//namespace Ugly

#endif // __ULGYOPENGLERROR_H__
